package view;

import java.awt.Color;
import java.util.ArrayList;

import javax.swing.JList;
import javax.swing.border.LineBorder;

import model.Commande;
import model.LigneCommandeRestaurant;

public class CommandeViewer extends JList
{
	public CommandeViewer()
	{
		setBorder(new LineBorder(Color.BLACK));
	}
	
	public void update(Commande c)
	{
		ArrayList<Object> listData = new ArrayList<Object>();
		for(LigneCommandeRestaurant lcr : c.getLignesCommandeRestaurant())
		{
			listData.add(lcr);
			listData.addAll(lcr.getLignesCommande());
		}
		
		setListData(listData.toArray());
	}
}
